package com.ty.mianshiya.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ty.mianshiya.model.dto.question.QuestionQueryRequest;
import com.ty.mianshiya.model.entity.Question;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ty.mianshiya.model.vo.QuestionVO;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author WangJiyou
 * @description 针对表【question(题目)】的数据库操作Service
 * @createDate 2024-09-09 22:35:58
 */
public interface QuestionService extends IService<Question> {

    void validQuestion(Question question, boolean b);

    QuestionVO getQuestionVO(Question question, HttpServletRequest request);

    Wrapper<Question> getQueryWrapper(QuestionQueryRequest questionQueryRequest);

    Page<QuestionVO> getQuestionVOPage(Page<Question> questionPage, HttpServletRequest request);

    /**
     * 根据题库查询题目列表接口
     *
     * @param questionQueryRequest
     * @return
     */
    Page<Question> listQuestionByPage(QuestionQueryRequest questionQueryRequest);

    /**
     * 从 ES 查询题目
     *
     * @param questionQueryRequest
     * @return
     */
    Page<Question> searchFromEs(QuestionQueryRequest questionQueryRequest);
    /**
     * 批量删除题目
     * @param questionIdList
     */
    void batchDeleteQuestion(List<Long> questionIdList);

    /**
     * 测试分布式锁的作用
     */
    void testLock();

}
